package cn.lg.soar.cms.biz.modules.other.model;

import cn.lg.soar.cms.biz.modules.other.entity.Block;
import cn.lg.soar.system.api.annotations.FileBizType;
import cn.lg.soar.system.api.model.FileVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 页面位置
 * @author luguoxiang
 * @since 2023-03-19
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
@Accessors(chain = true)
@ApiModel(value = "WebPosition", description = "页面位置")
public class BlockVO extends Block {

    @FileBizType("WebPositionImg")
    @ApiModelProperty(value = "位置截图")
    private List<FileVO> imgs;

    public static BlockVO from(Block entity) {
        if (entity == null) {
            return null;
        }
        BlockVO vo = new BlockVO();
        vo.setId(entity.getId());
        vo.setCode(entity.getCode());
        vo.setName(entity.getName());
        vo.setWidth(entity.getWidth());
        vo.setHeight(entity.getHeight());
        vo.setDescription(entity.getDescription());
        return vo;
    }
}
